<?php
/**
 * Created by JetBrains PhpStorm.
 * User: dvynograd
 * Date: 22.01.13
 * Time: 15:22
 * To change this template use File | Settings | File Templates.
 */

namespace Vozminoski\StoreBundle\DataFixtures\ORM;

use Doctrine\Common\DataFixtures\AbstractFixture;
use Doctrine\Common\Persistence\ObjectManager;
use Vozminoski\StoreBundle\Entity\Color;
use Doctrine\Common\DataFixtures\OrderedFixtureInterface;


class LoadColorData extends AbstractFixture implements OrderedFixtureInterface
{
    /**
     * {@inheritDoc}
     */
    public function load(ObjectManager $manager)
    {
        $color = new Color();
        $color->setIsActive(true);
        $color->setOrder(1);
        $color->setName('Черный');
        $color->setCode('000');
        $manager->persist($color);

        $color = new Color();
        $color->setIsActive(true);
        $color->setOrder(2);
        $color->setName('Синий');
        $color->setCode('0e4198');
        $manager->persist($color);


        $color = new Color();
        $color->setIsActive(true);
        $color->setOrder(3);
        $color->setName('Серый');
        $color->setCode('626262');
        $manager->persist($color);

        $color = new Color();
        $color->setIsActive(true);
        $color->setOrder(4);
        $color->setName('Красный');
        $color->setCode('ff0000');
        $manager->persist($color);


        $color = new Color();
        $color->setIsActive(true);
        $color->setOrder(4);
        $color->setName('Белый');
        $color->setCode('98b1d3');
        $manager->persist($color);

        $manager->flush();
    }

    /**
     * {@inheritDoc}
     */
    public function getOrder()
    {
        return 1; // the order in which fixtures will be loaded
    }
}